﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using Dal;
using IDal;

namespace DalFactory
{
    /// <summary>
    /// DbSession来操作数据，更加方便,利于数据的批量处理,
    /// 数据提交的权利，由数据访问层提到了业务逻辑层
    /// </summary>
    public partial class DalSession:IDalSession
    {
		public ModelContainer CurrentDbContext
        {
            get
            {
                return (ModelContainer)DbContextUtil.GetCurrentDbContext();
            }
        }
		public IUserInfoDal UserInfoDal
		{
			get
			{
				return DalFactory.GetUserInfoDal();
			}
		}
		/// <summary>
        /// 拿到了当前EF的上下文，然后把实体进行一个整体的修改(数据操作的控制权转移到Bll层)
        /// </summary>
        /// <returns></returns>
        public int SaveChanges() {
            return CurrentDbContext.SaveChanges();
        }
	}
}
    